package com.shujia.scala

object Demo5While {
  def main(args: Array[String]): Unit = {
    var i = 1
    var sum = 1
    while (i <= 10) {
      sum *= i
      i += 1
    }
    println(sum)

    //  *
    // ***
    //*****
    println("  *")
    println(" ***")
    println("*****")

    println("*" * 100)
    //重复的代码通过循环来实现
    var j = 1
    while (j <= 3) {
      println(s"${" " * (3 - j)}${"*" * (2 * j - 1)}")
      j += 1
    }
  }
}
